const path = require('path')
const CopyWebpackPlugin = require('copy-webpack-plugin')
module.exports = {
  transpileDependencies: ['uview-ui'],
  runtimeCompiler: true,
  configureWebpack: {
    module: {
      rules: [
        {
          test: /\.m?js$/,
          exclude: /(src[\\\/]uni_modules)/,
          include: /(node_modules[\\\/]@ct)/,
          use: {
            loader: 'babel-loader',
            options: {
              presets: [['@babel/preset-env', { modules: false }]],
              plugins: [
                '@babel/plugin-proposal-nullish-coalescing-operator',
                '@babel/plugin-proposal-optional-chaining'
              ]
            }
          }
        }
      ]
    },
    plugins: [
      new CopyWebpackPlugin([{
        from: path.join(__dirname, 'public/configUrl.js'),
        to: path.join(__dirname, 'dist/configUrl.js')
      }])
    ]
  }
}
